home *** CD-ROM | disk | FTP | other *** search
Wrap
- drawPageBorder:(float)width :(float)height { static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" }; DPSContext context = DPSGetCurrentContext(); struct tm *now; long t; /* Let's be moderately well behaved at least. */ [super drawPageBorder:width :height]; if (context) { /* Use Ohlfs 10 point for the header font. */ DPSPrintf(context, "/Ohlfs findfont\n"); DPSPrintf(context, "10 scalefont\n"); DPSPrintf(context, "setfont\n"); /* Print the page number right justified at the top of the ** page. */ DPSPrintf(context, "/NLPRPageString (Page %d) def\n", [[NXApp printInfo] currentPage]); DPSPrintf(context, "%g NLPRPageString stringwidth pop sub\n", width - 30.); DPSPrintf(context, "%g moveto\n", height - 30.); DPSPrintf(context, "NLPRPageString show\n"); /* Print the date and file name. */ time(&t); now = localtime(&t); DPSPrintf(context, "30 %g moveto\n", height - 30.); DPSPrintf(context, "(%s %d, %d %d:%d %s) show\n", months[now->tm_mon], now->tm_mday, now->tm_year + 1900, now->tm_hour, now->tm_min, filename); /* Draw a line under the thing. */ DPSPrintf(context, "2 setlinewidth 30 %g moveto %g %g lineto stroke\n", height - 33., width - 30., height - 33.); } return self; } - chooseEncoding:sender { int choice = NXRunAlertPanel("Choose Encoding...","You can optimize the HTML generated to work around particular clients. To permanently change your default encoding, \"dwrite eText HTMLEncoding Type\" (look in the app wrapper).", "Strict HTML","XMosaic","OmniWeb"); switch (choice) { case NX_ALERTDEFAULT: NXSetDefault([NXApp appName], "HTMLEncoding", "ASCII"); break; case NX_ALERTALTERNATE: NXSetDefault([NXApp appName], "HTMLEncoding", "XMosaic"); break; case NX_ALERTOTHER: NXSetDefault([NXApp appName], "HTMLEncoding", "OmniWeb"); break; } flushHTMLEncoding(); // yeah, it's a memory leak. so f*cking sue me. return self; } eTdoc needs -eText - savePanel:(int)fmt { static id it = nil; if (!it) { const char *docdir; it = [SavePanel new]; docdir = NXGetDefaultValue([NXApp appName], "ETFDirectory"); if (docdir && *docdir) { [it setDirectory:docdir]; } } [it setAccessoryView:spaView]; if (fmt>=0) [spaM selectCellWithTag:fmt]; return it; } - detachAgent:sender { if (![[[NXApp mainWindow] delegate] etDoc]) return nil; if (![[[[NXApp mainWindow] delegate] etDoc] acceptsAgent]) { int choice = NXRunAlertPanel("Detach Agent", "Are you sure you want to remove the agent currently working with this document? You cannot undo this action.", "Remove", "Cancel", NULL); if (choice == NX_ALERTALTERNATE) {return nil;} [[[[NXApp mainWindow] delegate] etDoc] detachAgent]; } return self; }